<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>

<style type="text/css">
body{
	text-align: center;
}
td{
	margin-bottom: 20px;
}
.inputBox{
	height:15px;
	width:120px;
}
</style>

<script type="text/javascript">
$(document).ready(function(){
	$("#creatBt").click(function(){
		if(!check()){
			return;
		}
		var  userName = $("input#userName").val();
		var  passWord = $("input#passWord").val();
		var  rePassWord = $("input#rePassWord").val();
		var  mailBox = $("input#mailBox").val();
		var  phoneNum = $("input#phoneNum").val();
		var  adminType = $("input#adminType").val();
		$.ajax({
			type : "POST",
			url : "servlet/AdminLoginServlet",
			data: "userName="+userName+"&passWord="+passWord,
			success : function(result) {
				if(result=="success"){
					window.location.href ="<%=basePath%>admin/main.jsp";
				}else{
					$("#passWord").val("");
					alert("登录失败,请核对您输入的用户名和密码");
				}
			}
		});	
	});
	
	$("#reset").click(function(){
		$("#userName").val("");
		$("#passWord").val("");
	});
	
	$("#cancelBt").click(function(){
		window.location.reload(true);
	});
	
});


 function check()
 {
     if ($("#userName").val()=="")
     {
        alert("请输入用户名!!!");
 		$("#userName").focus(); 
       return false;
     }
     if ($("#passWord").val()=="")
     {
       alert("请输入密码!!!");
       $("#passWord").focus(); 
       return false;
     }
     return true;
 }
 </script>
</head>

<body>
	<table style="margin-top:30px; text-align: center;margin-left: 90px;">
    	<tr>
        	<td height="18px">用户名</td>
            <td><input class="inputBox" id="userName" type="text" name="userName" /></td>
        </tr>
        <tr>
        	<td height="18px" >密码</td>
            <td><input class="inputBox" id="passWord" type="password" name="passWord" /></td>
        </tr>
        <tr>
        	<td height="18px">确认密码</td>
            <td><input class="inputBox" id="rePassWord" type="password" name="rePassWord" /></td>
        </tr>
        <tr>
        	<td height="18px">邮箱</td>
            <td><input class="inputBox" id="mailBox" type="text" name="mailBox" /></td>
        </tr>
        <tr>
        	<td height="18px">联系电话</td>
            <td><input class="inputBox" id="phoneNum" type="text" name="phoneNum" /></td>
        </tr>
        <tr>
        	<td height="18px">管理员类型</td>
            <td><select name="adminType" id="adminType"> 
            	<option selected="selected" value="1" >客商管理员</option>         			
            	<option value="2">物流统计管理员</option>         
            	<option value="3">财务管理员</option>         
                </select> 
            </td>
        </tr>
        <tr>
        	<td><input type="button" id="creatBt" value="添加" name="subButton"/></td>
        	<td><input type="button" id="cancelBt" value="取消" name="resButton"/></td>        
        </tr>
    </table>
    
</body>
</html>
